package com.xuelang.pipeline.artifact.client.resource.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xuelang.pipeline.artifact.client.common.validator.KeyInfoEncrypted;
import com.xuelang.pipeline.artifact.client.common.validator.ValidEnum;
import com.xuelang.pipeline.artifact.client.resource.enums.ArtifactToolEnum;
import lombok.*;

import jakarta.validation.constraints.NotEmpty;
import java.util.Date;

/**
 * 仓库用户DTO
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
public class ArtifactUserDTO {
    /**
     * id，新增时为空，修改是不为空
     */
    private Long id;
    /**
     * 业务用户名
     */
    @NotEmpty(message = "业务用户名不能为空")
    private String userName;

    /**
     * 业务用户ID
     */
    @NotEmpty(message = "业务用户ID不能为空")
    private String userId;

    /**
     * 仓库角色标识，MANAGER管理员、DEVELOPER开发员、USER普通用户
     */
    @ValidEnum(enumClass = ArtifactToolEnum.RoleEnum.class, message = "仓库角色标识不正确")
    private String artifactRoleCode;

    /**
     * 仓库角色ID
     */
    @NotEmpty(message = "仓库角色ID不能为空")
    private String artifactRoleId;

    /**
     * 仓库用户名
     */
    @NotEmpty(message = "仓库用户名不能为空")
    private String artifactUserName;

    /**
     * 仓库用户ID
     */
    @NotEmpty(message = "仓库用户ID不能为空")
    private String artifactUserId;
    /**
     * 仓库用户密码
     */
    @KeyInfoEncrypted
    @NotEmpty(message = "仓库用户密码不能为空")
    private String artifactUserPassword;
    /**
     * 仓库UUID
     */
    @NotEmpty(message = "仓库UUID不能为空")
    private String artifactUuid;

    /**
     * 仓库类型，可选值GENERIC/DOCKER/MAVEN/NPM，单选
     */
    @ValidEnum(enumClass = ArtifactToolEnum.ArtifactTypeEnum.class, message = "仓库类型不正确")
    private String artifactType;

    /**
     * 创建人
     */
    private String creatorId;

    /**
     * 创建时间
     */
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新人ID
     */
    private String updaterId;

    /**
     * 更新时间
     */
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 0否/删除、1是/使用，默认值为1
     */
    private Integer useFlag;


}
